package com.zy.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zy.service.CustomerService;
import com.zy.service.impl.CustomerServiceImpl;

/**
 * Servlet implementation class DeleteCustServlet
 */
@WebServlet("/DeleteCustServlet")
public class DeleteCustServlet extends HttpServlet {
	CustomerService cs = new CustomerServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		System.out.println(request.getParameter("id"));
		int param = Integer.parseInt(request.getParameter("id"));
		cs.deleteCustomer(param);
		response.sendRedirect(request.getContextPath()+"/PageLimitServlet?currentPage=1");
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
